package com.wskj.service.impl;

import com.wskj.client.SupplierClient;
import com.wskj.entity.Goods;
import com.wskj.entity.Supplier;
import com.wskj.mapper.GoodsMapper;
import com.wskj.service.IGoodsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 商品信息表 服务实现类
 * </p>
 *
 * @author 顽石教育-www.wskj.com
 * @since 2021-09-07
 */
@Service
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements IGoodsService {

    @Autowired
    private SupplierClient client;

    @Override
    public Goods findById(Integer id) {
        Goods goods = this.getById(id);

        //查询该商品对应的供应商详情
        Supplier suppliers = client.findBySupplierId(id);
        goods.setSuppliers(suppliers);
        return goods;


    }
}
